"""
drawing.py

Created by daspork on 2012-04-20.
Copyright (c) 2012 Knuckledragger Games. All rights reserved.
"""

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *

import vectorfont


def DrawAxis():
    glBegin(GL_LINES);
    
    ## X
    glColor3d(1.0, 0.0, 0.0);
    glVertex3d(0.0, 0.0, 0.0);
    glVertex3d(3.0, 0.0, 0.0);
    
    ## Y
    glColor3d(0.0, 1.0, 0.0);
    glVertex3d(0.0, 0.0, 0.0);
    glVertex3d(0.0, 3.0, 0.0);
    
    ## Z
    glColor3d(0.0, 0.0, 1.0);
    glVertex3d(0.0, 0.0, 0.0);
    glVertex3d(0.0, 0.0, 3.0);
    
    glEnd();    


def DrawBlork():
    glBegin(GL_LINES)
    glColor3d(0.0, 0.8, 0.0);
    for line in vectorfont.GetCharVerts('3'):
        glVertex3d(line[0], line[1], 0.0)
        glVertex3d(line[2], line[3], 0.0)
    glEnd()


def DrawString(s, color=(0.0, 0.8, 0.0), scale=1, spacing=1.2):
    verts = vectorfont.BuildString(s, spacing, scale)
    glBegin(GL_LINES)
    glColor3d(color[0], color[1], color[2]);
    for char in verts:
        for line in char:
            glVertex3d(line[0], line[1], 0.0)
            glVertex3d(line[2], line[3], 0.0)
    glEnd()




